<?php

namespace Utility\ServiceLocator;

use Zend\ServiceManager\ServiceManager;

class ServiceLocator {

	/**
	 * @var ServiceManager
	 */
	private static $serviceManager = null;

	/**
	 * @throw ServiceLocatorFactory\NullServiceLocatorException
	 * @return ServiceManager
	 */
	public static function getServiceLocator() {
		if (null === self::$serviceManager) {
			throw new NullServiceLocatorException('ServiceLocator is not set');
		}
		return self::$serviceManager;
	}

	/**
	 * @param ServiceManager
	 */
	public static function setServiceLocator(ServiceManager $sm) {
		self::$serviceManager = $sm;
	}

}
